<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="<%=basePath%>Js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mycss/bootstrap.min.css" />
</head>
<script type="text/javascript">

//确认配送
function affirmIndent(serialnum){
	
	$.ajax({
		type:"post",
		url:"affirmIndent.do",
		async: false,
		data:{
			"serialnum":serialnum,
		},
		dataType:"text",
		success:function(result){
			
			if(result == "1"){
				alert("确认订单成功")
			}else{
				alert("确认订单失败")
			}
			
		},
		error:function(){
			alert("系统故障")
		}
	})
}

</script>
<body>
<hr><h3 align="center">消费记录</h3><hr>

	<table class="table table-bordered">
		<tr>
			<th>订单编号</th>
			<th>房间号</th>
			<th>商品名称</th>
			<th>商品分类</th>
			<th>单价</th>
			<th>购买数量</th>
			<th>下单时间</th>
			<th>订单状态</th>
			<th>操作</th>
			<th>备注</th>
		</tr>
		<c:forEach items="${pageInfo.list}" var="conlist">
		<tr>
			<td>${conlist.serialnum}</td>
			<td>${conlist.roomnumber}</td>
			<td>${conlist.product}</td>
			<td>${conlist.classify}</td>
			<td>${conlist.price}</td>
			<td>${conlist.quantity}</td>
			<td>${conlist.reserved2}</td>
			
				<c:choose>
					<c:when test="${conlist.state == '2'}">
						<td>配送中</td>
					</c:when>
					<c:when test="${conlist.state == '1'}">
						<td>订单完成</td>
					</c:when>
					<c:otherwise>
						<td>待配送</td>
					</c:otherwise>
				</c:choose>
				
				<c:choose>
					<c:when test="${conlist.state == '2'}">
						<td><a href="" onclick="affirmIndent('${conlist.serialnum}')">确认送达</a></td>
					</c:when>
					<c:otherwise>
						<td></td>
					</c:otherwise>
				</c:choose>
			
			<td>${conlist.remark}</td>
		</tr>
		</c:forEach>
	</table>

	<div id="page1">
		<c:if test="${!pageInfo.isFirstPage }">
			<a href="${pageContext.request.contextPath }/selectConsumption_recordByvipNumber.do">首页</a>
			<a
				href="${pageContext.request.contextPath }/selectConsumption_recordByvipNumber.do?pageNum=${pageInfo.prePage}">上一页</a>
		</c:if>
		<c:if test="${!pageInfo.isLastPage }">
			<a
				href="${pageContext.request.contextPath }/selectConsumption_recordByvipNumber.do?pageNum=${pageInfo.nextPage}">下一页</a>
			<a
				href="${pageContext.request.contextPath }/selectConsumption_recordByvipNumber.do?pageNum=${pageInfo.lastPage}">末页</a>
		</c:if>
		当前页：${pageInfo.pageNum }/${pageInfo.pages }.
	</div>



</body>
</html>